package com.gzhryc.shared_device.common.payment.dao.db;

import com.gzhryc.common.NumberTools;
import com.gzhryc.jdbc.annotaion.Column;
import com.gzhryc.jdbc.annotaion.DateBranchTable;
import com.gzhryc.jdbc.annotaion.Id;
import com.gzhryc.jdbc.annotaion.Table;
import com.gzhryc.jdbc.enums.DateBranchTableType;
import com.gzhryc.pay.enums.TradeType;
import com.gzhryc.pay.models.IRefundOrder;
import com.gzhryc.shared_device.base.enums.ERefundState;
import com.gzhryc.shared_device.common.payment.dao.enums.WXPayConfigEnum;

import java.util.Date;

/**
 * 微信退款订单
 * @version 2022-09-09
 */
@DateBranchTable(type = DateBranchTableType.year)
@Table(name="payment_wx_refund_order")
public class WXRefundOrder implements IRefundOrder {

    private static final long serialVersionUID = 1L;

    @Id(auto = false)
    @Column(name = "trade_no",notNull = true,note = "退款订单号")
    protected String tradeNo;

    @Column(length = 255, note = "退款描述")
    protected String note;

    @Column(name = "pay_trade_no", notNull = true, note = "支付订单号")
    protected String payTradeNo;

    @Column(name = "external_pay_trade_no", length = 64, note = "第三方支付订单编号")
    protected String externalPayTradeNo;

    @Column(name = "pay_money",note = "支付金额")
    protected Integer payMoney;

    @Column(name = "business_type", notNull = true,note = "业务类型")
    protected String businessType;

    @Column(name = "business_type_name",notNull = true,  note = "业务类型")
    protected String businessTypeName;

    @Column(name = "business_trade_no", notNull = true, note = "业务订单号")
    protected String businessTradeNo;

    @Column(name = "external_trade_no", length = 64, note = "第三方退款订单编号")
    protected String externalTradeNo;

    @Column(name = "app_type", notNull = true,note = "应用类型")
    protected Integer appType;

    @Column(name = "app_id", notNull = true, note = "应用ID")
    protected String appId;

    @Column(name = "payer_id", length = 64, note = "第三方支付的用户ID")
    protected String payerId;

    @Column(name = "business_account", length = 64,notNull = true, note = "商户账号")
    protected String businessAccount;

    @Column(name = "trade_type", notNull = true,note = "订单类型，normal:普通订单，支付分订单")
    protected String tradeType;

    @Column(name = "refund_money", notNull = true,defVal = "0",note = "退款金额")
    protected Integer refundMoney;

    @Column(name = "external_content", type = "TEXT", note = "第三方退款订单内容")
    protected String externalContent;

    @Column(name = "refund_date", note = "退款时间")
    protected Date refundDate;

    @Column(name = "refund_status", notNull = true,defVal = "1",note = "退款状态")
    protected Integer refundStatus;

    @Column(name = "fail_note", length = 255, note = "失败描述")
    protected String failNote;

    @Column(name = "update_date", note = "修改时间", autoUpdateTime = true)
    protected Date updateDate;

    @Column(name = "create_date", note = "创建时间")
    protected Date createDate;

    @Override
    public String getTradeNo() {
        return tradeNo;
    }

    public void setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo;
    }

    @Override
    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public String getBusinessType() {
        return businessType;
    }

    public void setBusinessType(String businessType) {
        this.businessType = businessType;
    }

    public String getBusinessTypeName() {
        return businessTypeName;
    }

    public void setBusinessTypeName(String businessTypeName) {
        this.businessTypeName = businessTypeName;
    }

    public String getBusinessTradeNo() {
        return businessTradeNo;
    }

    public void setBusinessTradeNo(String businessTradeNo) {
        this.businessTradeNo = businessTradeNo;
    }

    public String getExternalTradeNo() {
        return externalTradeNo;
    }

    public void setExternalTradeNo(String externalTradeNo) {
        this.externalTradeNo = externalTradeNo;
    }

    public Integer getAppType() {
        return appType;
    }

    public void setAppType(Integer appType) {
        this.appType = appType;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getPayerId() {
        return payerId;
    }

    public void setPayerId(String payerId) {
        this.payerId = payerId;
    }

    public String getBusinessAccount() {
        return businessAccount;
    }

    public void setBusinessAccount(String businessAccount) {
        this.businessAccount = businessAccount;
    }

    public String getTradeType() {
        return tradeType;
    }

    public void setTradeType(String tradeType) {
        this.tradeType = tradeType;
    }

    public String getExternalContent() {
        return externalContent;
    }

    public void setExternalContent(String externalContent) {
        this.externalContent = externalContent;
    }

    public String getPayTradeNo() {
        return payTradeNo;
    }

    public void setPayTradeNo(String payTradeNo) {
        this.payTradeNo = payTradeNo;
    }

    @Override
    public String getExternalPayTradeNo() {
        return externalPayTradeNo;
    }

    public void setExternalPayTradeNo(String externalPayTradeNo) {
        this.externalPayTradeNo = externalPayTradeNo;
    }

    @Override
    public Integer getPayMoney() {
        return payMoney;
    }

    public void setPayMoney(Integer payMoney) {
        this.payMoney = payMoney;
    }

    @Override
    public Integer getRefundMoney() {
        return refundMoney;
    }

    public void setRefundMoney(Integer refundMoney) {
        this.refundMoney = refundMoney;
    }

    public Date getRefundDate() {
        return refundDate;
    }

    public void setRefundDate(Date refundDate) {
        this.refundDate = refundDate;
    }

    public Integer getRefundStatus() {
        return refundStatus;
    }

    public void setRefundStatus(Integer refundStatus) {
        this.refundStatus = refundStatus;
    }

    public String getFailNote() {
        return failNote;
    }

    public void setFailNote(String failNote) {
        this.failNote = failNote;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getTradeTypeName(){
        return TradeType.note(this.tradeType);
    }

    public String getRefundStatusName(){
        return ERefundState.note(this.refundStatus);
    }

    public String getRefundMoneyStr(){
        return NumberTools.getMoneyStr(this.refundMoney);
    }

    public String getAppTypeName(){
        return WXPayConfigEnum.AppType.note(this.appType);
    }

}
